package org.dubbo.response;

import lombok.Data;

@Data
public class ApiResp {

    private int code;

    private String msg;

    private Object data;
    
    public static ApiResp error() {
        ApiResp resp = new ApiResp();
        resp.setCode(1);
        resp.setMsg("系统异常");
        return resp;
    }
    
    public static ApiResp error(String msg) {
        ApiResp resp = new ApiResp();
        resp.setCode(1);
        resp.setMsg(msg);
        return resp;
    }
    
    public static ApiResp success(Object data) {
        ApiResp resp = new ApiResp();
        resp.setCode(0);
        resp.setData(data);
        return resp;
    }

    public static ApiResp success() {
        ApiResp resp = new ApiResp();
        resp.setCode(0);
        return resp;
    }
}
